home *** CD-ROM | disk | FTP | other *** search
- #include <asm.h>
- #include <Resources.h>
- #include <ShutDown.h>
- #include <Events.h>
-
- extern void SHOWINIT();
- #define IconID 128
- #define BadIconID 129
-
- /*
- shift - 0x38
- control - 0x3B
- esc - 0x35
- end - 0x77
- */
-
- void
- main(void)
- {
- long key[4];
- unsigned char *theKeys;
- Handle KeyH;
-
- KeyH = GetResource('SKey', 128);
- if (KeyH == NULL || *KeyH == NULL)
- {
- asm
- {
- move.w #BadIconID,-(sp) ; load ICN# ID
- move.w #-1,-(sp) ; use default moveX
- bsr SHOWINIT ; draw the icon
- }
- return;
- }
-
- GetKeys(key);
-
- theKeys = (unsigned char *)(key);
-
- if ((theKeys[(*((unsigned short*)*KeyH)) >> 3] >> ((*((unsigned short*)*KeyH)) & 7)) & 1)
- ShutDwnPower();
-
- ReleaseResource(KeyH);
-
- asm /* show init */
- {
- move.w #IconID,-(sp) ; load ICN# ID
- move.w #-1,-(sp) ; use default moveX
- bsr SHOWINIT ; draw the icon
- }
-
- }